-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-119053: Implement the fast path for list.__getitem__ #119112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I noticed that we perform a validity check on the index several times now:
- In list_item
- In list_get_item_ref
- In list_item_impl (if we end up taking the slow path)
While this doesn't affect correctness, I think it would make sense to refactor the code to eliminate the redundant checks given how performance sensitive this code is. That could be tackled in a separate PR, though.
Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…gh-119112) (cherry picked from commit ab4263a) Co-authored-by: Donghee Na <donghee.na@python.org>
GH-119309 is a backport of this pull request to the 3.13 branch. |
list.__getitem__
#119053